﻿using FDStudio.Core.Entities;
using FDStudio.Core.Entities.Query;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;

namespace FDStudio.Core.Services
{
    /*
     CreatedOn: 2018-03-08
     CreatedBy: Jackie Lee(天宇遊龍)
     */
    /// <summary>
    /// 只读服务接口
    /// </summary>
    public interface IReadOnlyService<T> : IService where T : class, IEntity
    {
        bool Exists(Expression<Func<T, bool>> condition);

        T Get(long id);

        T Get(Expression<Func<T, bool>> condition);

        IEnumerable<T> GetList(Expression<Func<T, bool>> condition, IQueryOrder<T> orderBy = null);

        /// <summary>
        /// 进行分页操作
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="condition"></param>
        /// <param name="pagingAction">传入查询字符串，根据所需处理并返回结果查询字符串</param>
        /// <param name="orderBy"></param>
        /// <returns></returns>
        PagedList<T> GetList(Expression<Func<T, bool>> condition, long pageIndex, long pageSize, IQueryOrder<T> orderBy = null);

    }
}
